<template>
	<gui-page ref="guiPage" :customHeader="true">
		<!-- 导航 -->
		<template v-slot:gHeader>
			<nav-bar-custom left-icon="left" :title="$t('taskManagement.changePriority')" @clickLeftBack="clickLeftBack" scanType="0"></nav-bar-custom>
		</template>

		<template v-slot:gBody>
			<view class="page-auto-noheight paddingbottom">
				<!-- 调拨单信息 -->
				<view class="custom-form-card">
					<view class="custom-card-title">
						<text class="title-line"></text>
						{{ $t('taskManagement.message') }}
					</view>
					<view class="custom-card-itemOne">
						<text class="item-info-title">{{ $t('taskManagement.taskNo') }}：</text>{{ props.id }}
					</view>
				</view>
				<view class="custom-form-card">
					<view class="custom-card-title">
						<text class="title-line"></text>
						{{ $t('taskManagement.change') }}
					</view>
					<view class="custom-card-itemTwo" style="padding: 20rpx 0;">
						<text class="item-info-title"><text
								class="required-color">*</text>{{ $t('taskManagement.priority') }}：</text>
						<uni-easyinput class="uni-mt-5" v-model="data.priority"
							:placeholder="$t('taskManagement.inputNumber')" type="number">
						</uni-easyinput>
					</view>
				</view>
				<!-- 底部操作栏 -->
				<view class="page-bottom-box bottom-postion">
					<view class="page-bottomBtn bottomBtn-bgcolor-green" @click="submit">
						{{ $t('calendar.submit') }}
					</view>
				</view>
			</view>
		</template>
	</gui-page>
</template>

<script setup>
//引入文件
import { ref, reactive, onMounted, computed, watch, toRaw } from "vue";
import pdaScan from '@/hooks/pdaScan.js';
import searchCustom from '@/components/searchCustom';
import calendarCustom from '@/components/calendarCustom';
import superweiCombox from '@/components/superweiCombox';
import openView from '@/components/common/openView';
import { onShow } from '@dcloudio/uni-app';
import { onBackPress } from '@dcloudio/uni-app';
import { navigate } from '@/utils/routerSkip.js';
import { useStore } from "vuex";
import { basPdaOperationLogFn } from '@/utils/index.js';
import { OPERATION_COMMIT, OPERATION_SCAN } from '@/constant/index.js';
import { DEFAULT_WAREHOUSECODE, DEFAULT_WAREHOUSENAME, DEFAULT_WAREHOUSEID, BIGBARCODER_PRINT, OPERATION_LOOK } from '@/constant/index.js';
import { modifyTaskPriority } from '@/api/api.js'

//JS国际化引入
import { useI18n } from 'vue-i18n';
//注册组件
components: {
	searchCustom,
		superweiCombox,
		calendarCustom,
		openView
}
const { t } = useI18n();
const props = defineProps({
	id: String
})

let store = useStore();
const { scan } = pdaScan();

const data = reactive({
	priority: null,//优先级
})

const submit = () => {
	modifyTaskPriority({
		taskCode: props.id,
		secondPriority: Number(data.priority)
	}).then(res => {
		try {
			let inputParameter = JSON.stringify(parmes)
			let returnParameter = JSON.stringify(res)
			let operationPicture = 'AGV任务管理-修改优先级'
			let callInterface = res.rquestUrl
			let opertionParmes = {
				inputParameter,
				returnParameter,
				operationPicture,
				callInterface,
				responseCode: res.code,//返回状态
				errorMessage: res.message,//错误信息
				isPass: res.code == 200 ? 'Y' : 'N',//是否成功 Y N
				operationType: OPERATION_LOOK,
				module: 'WMS',
				source: "PDA",
			}
			basPdaOperationLogFn(opertionParmes)
		} catch (error) {
		}
		if (res.code == 200) {
			uni.showToast({ title: smashRemoval.submitSuccessfully, icon: 'none' })
			uni.navigateBack({
				delta: 1
			});
		} else {
			uni.showToast({ title: res.message, icon: 'none' })
		}
	})
}

// 左侧返回
onBackPress((options) => {
	if (options.from == 'backbutton') {
		navBackCheck()
		return true;
	}
})
//导航栏左侧返回
const clickLeftBack = () => {
	navBackCheck()
}
const navBackCheck = () => {
	uni.navigateBack({
		delta: 1
	});
}

</script>

<style lang="scss" scoped>
.barcodeSplitting {
	display: flex;
	flex-direction: column;
	height: calc(100vh - 88rpx);
	// height: 100vh;
}

.distributed-head {
	border-bottom-left-radius: 16rpx;
	border-bottom-right-radius: 16rpx;
}

.scroll {
	flex: 1;
	height: 2rpx;
}
</style>